public class Zahlentripel {

	/**
	 * @param args
	 */
		static int tripelMAX;
	    static double tripelA = 1;
	    static double tripelB = 2;
	    static int zaehler = 0;
	    static double tripelC;
	    static int borderA, borderB;
	    static String strAusgabe = "-->";
	    static int schleifendurchlauf = 0;
	    
	    public static String Tripel() 
	    {
	    //	if (tripelC < 0 || tripelC % 1 == 0 ) 
	    //		throw new IllegalArgumentException()
	    	borderB = (int)java.lang.Math.cbrt((java.lang.Math.pow((double)(tripelMAX - 1), 3) - 1));
	    	borderA = borderB /2 ;
	        while(tripelA <= borderB)
	        {
	        	while(tripelB <= borderB)
	        	{
	        		double cubeA = java.lang.Math.pow(tripelA, 3);
	        		double cubeB = java.lang.Math.pow(tripelB, 3);
	        		double unroundTripelC= java.lang.Math.sqrt((cubeA + cubeB));
	        		//System.out.println(tripelA);
	        		//System.out.println(cubeA);
	        		//System.out.println(tripelB);
	        		//System.out.println(cubeB);
	        		//System.out.println(unroundTripelC);
	        		double toroundtripelC = unroundTripelC*1000;
	        		double roundtripelC = Math.round( toroundtripelC ) ;
	        		tripelC = roundtripelC /1000;
	        		//System.out.println(toroundtripelC);
	        		//System.out.println(tripelC);
	        		if (tripelA <= tripelB && tripelC > 0){
	        			if (tripelC % 1 == 0){
	        				if (tripelC < tripelMAX)
	        				{
	        					strAusgabe = strAusgabe + ": " + "(" + (int)tripelA + "." + (int)tripelB + "." + (int)tripelC + ")";
	        					zaehler = zaehler +1;
	        					if (zaehler == 3)
	        					{
	        						strAusgabe = strAusgabe + '\n';
	        						zaehler = 0;
	        					}
	        				}
	        				else break;
	        			}
	        		}
	        		tripelB = tripelB + 1;
	        		
	        	}

	        	if (borderB > tripelA)
	        	{
	        		tripelA = tripelA + 1;
	        		tripelB = 1;
	        	}
	        	else
	        		break;

	    
	        }
        return strAusgabe;
	    }
}
	    
//public int Rech(){
//	tripelC = java.lang.Math.sqrt((java.lang.Math.pow(tripelA, 3) + java.lang.Math.pow(tripelB, 3)));
//	if (tripelC % 1 == 0){
//		Ausgabe = tripelA + "." + tripelB + "." + tripelC;
//		return Ausgabe;
//	}
//}
